package com.kantboot.business.bp.web.contrller;

import com.kantboot.business.bp.service.IBusBpGradeAndSubjectService;
import com.kantboot.util.common.result.RestResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 学科的控制器
 */
@RestController
@RequestMapping("/bus/bp/gradeAndSubject")
public class BusBpGradeAndSubjectController {

    @Resource
    private IBusBpGradeAndSubjectService service;

    /**
     * 根据年级ID查询年级和学科
     * @param gradeId 年级ID
     * @return 年级和学科
     */
    @RequestMapping("/getByGradeId")
    public RestResult getByGradeId(@RequestParam("gradeId") Long gradeId) {
        return RestResult.success(service.getByGradeId(gradeId),"getSuccess","获取成功");
    }

    /**
     * 根据学科ID查询年级和学科
     * @param subjectId 学科ID
     * @return 年级和学科
     */
    @RequestMapping("/getBySubjectId")
    public RestResult getBySubjectId(@RequestParam("subjectId") Long subjectId) {
        return RestResult.success(service.getBySubjectId(subjectId),"getSuccess","获取成功");
    }

}
